package com.neusoft.elm.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 实现Servlet接口的类
 * 发一个类似HTML网页的http请求，返回一个静态页面
 * 必须提供默认无惨的构造器 
 * @author admin
 *
 */
public class BusinessController01 extends HttpServlet {
	/**
	 * doGet响应get请求
	 */
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		获得系统的当前时间 
		Date  date =new Date();
//		格式化时间
		SimpleDateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String dates = format.format(date);
//		拼写HTML页面
		String html = "<html>"
				+ "<heade>"
				+ "<title>Date NOW</title>"
				+ "</heade>"
				+ "<body>"
				+ "<h2>"
				+ "NOE: " + dates
				+ "</h2>"
				+ "<img  src ='https://news-bos.cdn.bcebos.com/mvideo/log-news.png' />"
				
				+ "</body>"
				+ "</html> ";
//	向浏览器提供响应页面内容
//		获得输出流对象
		PrintWriter out = response.getWriter();
//		输出html内容
		out.write(html);
//		强制立即输出
		out.flush();
	}
	@Override
	/**
	 * 
	 */
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
	}
	
	 
}
